<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>天宝绿色食品网</title>
<style type="text/css">
.banquan {
	font-family: "宋体";
	font-size: 18px;
	background:#FAFAFA;
	color: #090;
	width:100%;
	height:100px;
	text-align:center;
	line-height:50px;
}
a:visited {
	text-decoration: none;
	color: #999;
}
a:link {
	text-decoration: none;
	color: #999;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
.jianju{
	height:50px;
}
.bgg {
	background-image: url(img/liuyan.jpg);
	background-repeat: repeat;
}
.boy {
	background-image: url(img/jieweiyi.jpg);
}
</style>
<div>
<!--banner图片滚动效果-->
<script>
setInterval(function(){
	var myimg =document.getElementById("myimg");
	if (myimg.src.match("banner3.jpg")){
		myimg.src="banner/banner4.jpg";
}
	else if(myimg.src.match("banner4.jpg")){
		myimg.src="banner/banner5.jpg";
	}
	else{
		myimg.src="banner/banner3.jpg";
	}
},3000)
</script>
<style type="text/css">
.ziti {
	font-size: 16px;
	。
	
	font-family: "宋体";
	float:left;
}
.heiti {
	font-family: "黑体";
	font-size: 24px;
}
a:link {
	text-decoration: none;
	color: #000;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
.huang {
	color:#F90;
	font-family:"黑体";
	font-size:20px;
	float:left;
}
.kaiti{
	font-size:20px;
	font-family:"楷体";
	text-align:center;
	color:#000;
}
</style>
<link href="style/logo.css" rel="stylesheet" type="text/css" />
<link href="style/aa.css" rel="stylesheet" type="text/css"/>
</head>

<body>
<!--导航栏-->
<div align="center">
<div class="container">

<link href="style/aa.css" rel="stylesheet" type="text/css" />
  <ul class="menu">
    <li><a href="denglu.php" style="color:#FFF">会员登录</a></li>
    <li><a href="zhuce.php" style="color:#FFF">免费注册</a></li>
    <li><img src="img/1.jpg" width="180" height="19px" /></li>
    <li><a href="food.php" style="color:#FFF">首页</a></li>
    <li class="has-submenu">推荐食品
      <ul>
        <li><a href="food.php?style=水果" style="color:#fff">新鲜水果</a></li>
        <li><a href="food.php?style=蔬菜" style="color:#FFF">营养蔬菜</a></li>
      </ul>
    </li>
    <li><a href="zixun.php" style="color:#FFF">食品咨询</a></li>
    <li><a href="liuyan.php" style="color:#FFF">留言反馈</a></li>
	<li><a style="color:#FFF" href="guanyu.php">关于我们</a></li>
  </ul>
</div>
<!--logo和搜索框-->
<link href="http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<div class="logo_bg">
<div class="div3"><img src="LOGO/logo.png" width="200px" height="90px" class="img"/></div>
<div id="container">
    <div class="search bar3">
        <form id="form1" name="ee" method="post" action="sosuo.php">
       
          <input name="tb_key" type="text" id="textfield" placeholder="请输入您要搜索的绿色食品...">
      
          <button type="submit" formmethod="post"></button>
      </form>
    </div>
</div>
</div>
<!--banner-->
<div style="width:1000px; height:50px; font-size:30px; margin:auto;">
</div>
<div style="width:1000px; height:300px; margin:auto;">
<img src="banner/banner3.jpg"  id="myimg" width="1000" height="300"; /> </div>

<!--正文内容-->
<div style="width:1000px; height:70px;"></div>
<div style="width: 1000px; height: 40px; float: left; font-size: 16px;">
<a style="color:#FC0;float:left">&nbsp;&nbsp;&nbsp;&nbsp;热卖水果：</a>
<a href="food.php?style=水果" style="color:#0C0; float: left; font-family: '宋体'; font-weight: bold;">水果/</a>
<a href="food.php?style=小吃" style="color: #0c0; float: left; font-family: '宋体'; font-weight: bold;">小吃</a>
</div>
<div style="color:#fc0; float:left; font-size:16px;">
<a style="color:#FC0;float:left">&nbsp;&nbsp;&nbsp;&nbsp;掌柜推荐：</a>
<a href="food.php?style=蔬菜" style="color:#0C0; float: left; font-family: '宋体'; font-weight: bold;">蔬菜/</a>
<a href="food.php?type=饮品" style="color: #0c0; float: left; font-family: '宋体'; font-weight: bold;">饮品</a></div>
</div>
<!--登录信息-->
  <div class="txt">
<?php
session_start();
if($_SESSION["name"]==""){
?>
<a href="denglu.php">你好，请登录</a>

<?php
}
else{
  echo($_SESSION["name"]."欢迎您");
	echo "<a href='del.php'>退出登陆</a>";
	}
?>

</div>
<!--展示-->
<?php
include("conn/conn.php");
$yin=$_GET[type];
$sty=$_GET[style];
$page=isset($_GET['p'])? $_GET['p']:1;
if($yin=="" && $sty==""){
$sql="select * from tb_video limit ".($page-1)*12 .",12";
}
else if ($yin !=""){
	$sql="select * from tb_video where type='".$yin."' limit ".($page-1) * 12 ." ,12";
		}
		else{
	$sql="select * from tb_video where style='".$sty."'  limit ".($page-1) * 12 ." ,12";
			}
$result=mysqli_query($link,$sql);
if(mysqli_num_rows($result)>0){
	$i=1;
		?>
        
    <div>
    <table width="1005" align="center" class="bgg">
<?php
while ($row=mysqli_fetch_assoc ($result)) {
	if($num % 4==0){
		echo "<tr>";
	}
	?>
    
      <td width="33% " align="center">
    <table width="98%" align="center"  class="ziti">
    <tr>
      <td><span class="huang">¥:
<?=$row[price]?>包邮</span>
     </td>
     
    </tr>
    <tr>
      <td align="left" class="ziti" > <a href="xinxi.php?id1=<?=$row[id]?>" style="color:#000"><?=$row[remark]?></a></td>
      <a href="xinxi.php?id1=<?=$row[id]?>"><img src="upfiles/video/<?=$row[picture]?>" width="200" height="180" class="img"><a></tr>
    <?php
	$i++;
			
	
?>
    </table>
	</td>
    	<?php
		if($num%4==3){
			echo "</tr>";
		}
		$num++;
}
		?>
      </table>
</div>
      <?php
}else{
	}
	  ?>

<!--上下页-->
<?php
$sql_all="select * from tb_video";
		
$result_all= mysqli_query($link,$sql_all);
$count=mysqli_num_rows($result_all);
if($count>1){
	?>
    <table width="300" align="center" height="100">
    <tr>
	<?php
$to_pages=ceil($count/12);
echo"<td class='kaiti'><a href='food.php'>首页</a></td>";
if($page<=1){
    echo "<td class='kaiti'><a href='food.php?p=1'>第一页</a></td>";
    }
	else{
    echo "<td class='kaiti'><a href='food.php?p=".($page-1)."'>上一页</a></td>";
}
if ($page<$to_pages){
    echo "<td class='kaiti'><a href='food.php?p=".($page+1)."'>下一页</a></td>";
 
 
}else{
    echo "<td class='kaiti'><a href='food.php?p=".($to_pages)."'>最后一页</a></td>";
}
}

?>
  </tr>
  </table>
<!--二段产品展示-->
<div style="color:#fc0; float:left; font-size:16px;">
<a style="color: #ED3034; float: left;">&nbsp;&nbsp;&nbsp;&nbsp;热卖中&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
<a href="food.php?type=热卖小吃" style="color:#999; float: left; font-family: '宋体'; ">热卖小吃/</a>
<a href="food.php?type=热卖饮品" style="color: #999; float: left; font-family: '宋体';">热卖饮品/</a>
<a href="food.php?type=热卖零食" style="color:#999; float: left; font-family: '宋体';">热卖零食</a>
</div>

  <?php
$yin=$_GET[type];
$sty=$_GET[style];
$page=isset($_GET['p'])? $_GET['p']:1;
if($yin=="" && $sty==""){
$sql="select * from tb_greenfood limit ".($page-1)*4 .",4";
}
else if ($yin !=""){
	$sql="select * from tb_greenfood where type='".$yin."' limit ".($page-1) * 4 ." ,4";
		}
		else{
	$sql="select * from tb_greenfood where style='".$sty."'  limit ".($page-1) * 4 ." ,4";
			}
$result=mysqli_query($link,$sql);
if(mysqli_num_rows($result)>0){
	$i=1;
	?>
<table width="1005" align="center" class="boy">
<?php
while ($row=mysqli_fetch_assoc ($result)) {
	if($num % 4==0){
		
	}
	?>
    
      <td width="33% " align="center">
    <table width="98%" align="center"  class="ziti">
    <tr>
      <td><span class="huang">¥:
<?=$row[price]?>包邮</span>
     </td>
     
    </tr>
    <tr>
      <td align="left" class="ziti" > <a href="xinxi.php?id2=<?=$row[id]?>" style="color:#000"><?=$row[remark]?></a></td>
      <a href="xinxi.php?id2=<?=$row[id]?>"><img src="upfiles/video/<?=$row[picture]?>" width="200" height="180" class="img"><a></tr>
    <?php
	$i++;
			
	
?>
    </table>
	</td>
    	<?php
		if($num%4==3){
			echo "</tr>";
		}
		$num++;
}
		?>
</table>
      </div>
      <?php
}else{
	}
	  ?>

<!--结尾版权信息-->
<div class="jianju"></div>
<div  class="banquan">
<div style="padding-top:10px;">公司名称：天宝绿色食品公司 电话：15565478543 传真：025-12345678 邮编：426100</div>
<div>版权归天宝绿色食品公司所有 粤ICP备 0703332572号</div>
</div>
</body>
</html>